home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- /* Enhancements:
- /* Make [solid] option for 24bp display.
- /* Make Single buffer RGB for 8bp P.I. (good for 3.3 dithering).
- /* Coincide dates for multiple data files.
- */
- #include "stdio.h"
- #include "demograph.h"
-
- #ifndef NULL
- #define NULL 0
- #endif
-
- #define FPSFLAG "-f"
-
- /* global variables */
- int x = 0; /* input coordinates */
- int y = 0;
- int drawtype; /* draw type -LINES, TOPS, SOLIDS, LIGHTED- see demograph.h */
- WINREC winrec; /* record of window locations and flags */
- CATEGORY *categoryroot = NULL; /* data category pointers */
- CATEGORY *curcategory = NULL;
- DATA *curdata; /* states data */
- char *statesbuf = NULL; /* map description - see states.c for details */
- MACHREC machrec; /* hardware options record */
-
- /* error message for demograph usage */
- char usage[] = "usage: demograph [-s statesfile] filename [filename ...]\n";
-
- /* flags for drawing action */
- int updatemap = FALSE;
- int updatetext = FALSE;
-
- /* flag to wait for queue input */
- int qpause = TRUE;
-
- void (*drawmap)(float *data);
- void displaydata(DATA *dataroot);
-
- /* functions found here */
- FILE *openfile(char *filename, char *rw);
- void getmach(void);
-
- main (int argc, char *argv[])
- {
- long qdev;
- short qval;
- int i;
-
- void getstates(int argc, char *argv[]);
- void getdata(int argc, char *argv[]);
- void getmach(void);
- void initwin(void);
- void qprocess(int dev, short val);
-
- getstates(argc,argv);
- getdata(argc,argv);
-
- getmach();
-
- winrec.fps = FALSE;
- for (i = 1; i < argc; i++) {
- if (strcmp(FPSFLAG,argv[i]) == 0) {
- winrec.fps = TRUE;
- break;
- }
- }
-
- initwin();
-
- while (TRUE) {
- if (qpause) {
- qdev = qread(&qval);
- qprocess(qdev,qval);
- } else {
- if (qtest()) {
- qdev = qread(&qval);
- qprocess(qdev,qval);
- }
- }
-
- if (updatemap) {
- (*drawmap)(curdata->data);
- }
- }
- }
-
-
- /* could do this using bits, but it might get confusing */
- void getmach()
- {
- if (getgdesc(GD_BITS_NORM_ZBUFFER) == 0)
- machrec.zbuffer = FALSE;
- else
- machrec.zbuffer = TRUE;
-
- if (getgdesc(GD_BITS_NORM_DBL_RED) == 0 ||
- getgdesc(GD_BITS_NORM_DBL_BLUE) == 0 ||
- getgdesc(GD_BITS_NORM_DBL_GREEN) == 0) {
- machrec.RGB = FALSE;
- } else {
- machrec.RGB = TRUE;
- }
- }
-
-
- /* OPENFILE opens a file for read */
- FILE *openfile(filename, rw)
- char *filename;
- char *rw;
- {
- FILE *fileptr;
-
- if ((fileptr = fopen(filename,rw)) == NULL) {
- fprintf(stderr,"cannot open file: %s\n",filename);
- exit(1);
- }
- return(fileptr);
- }
-
-
- void displaydata(dataroot)
- DATA *dataroot;
- {}
-